package com.project.service;


import com.project.dao.MajorMapper;
import com.project.entity.Major;
import com.project.service.base.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional(rollbackFor = Exception.class)
@Service
public class MajorServiceImpl extends BaseService implements MajorService {

    @Autowired
    MajorMapper majorMapper;

    @Override
    public Major findById(Integer id) {
        return majorMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Major> findByDepartmentid(Integer departmentid) {
        return majorMapper.selectByDepartmentid(departmentid);
    }

    @Override
    public List<Major> findByCondition(Major major) {
        return majorMapper.selectByCondition(major);
    }

    @Override
    public void add(Major major) {
        majorMapper.insertSelective(major);
    }
}
